package com.quan.controller;


import com.quan.entity.Student;
import com.quan.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/student")
public class StudentController {

    @Autowired
    private StudentService studentService;

    @PostMapping("/add")
    public void addStudent(@RequestBody String students) {
        studentService.addStudent(students);
    }

    @PostMapping("/addStudentData")
    public void addStudentData(@RequestBody List<Student> students) {
        studentService.addStudentData(students);
    }


    @GetMapping("/get")
    public void getStudent() {
        System.out.println("1");
        System.out.println("2");
        System.out.println("3");
    }

    @GetMapping("/getStudents")
    public List<Student> getStudents(){
        List<Student> studentData = studentService.getStudentData();
        return studentData;
    }


}
